

<style type="text/css">
    #file{
        opacity: 0.0;
	-moz-opacity: 0.0;
	filter: alpha(opacity=00);
        z-index: 9999;
        position: relative;
        left: 200px;
        width: 195px;
    }

     body{
        background-color: #FFF;
        font-family: verdana;
    }
    
   

    #label{
        width: 450px;
        margin: auto;
        text-align: center;

    }

    #submit{
        position: relative;
        top: -29px;
        left: 260px;
    }

    .required:after{content:' ';color:red;}

    #detalhamento
    {
        position: relative;
        margin: auto;        
        width: 300px;
        top: 110px;
    }
    .total{
        color: red;
        height: 30px;
        font-weight: bold;
        border-collapse:collapse;
        margin-top: 8px;
    }
    
    .line-total { border-top:1px solid #000; }
        
    #info{
        position: relative;
        font-size: 16px;
        width: 980px;
        margin: auto;
        color: #333;
        top: 40px;        
        padding-bottom: 20px;        
    }

    #info-depe{
        position: relative;
        font-size: 16px;
        width: 980px;
        margin: auto;
        color: #333;
        top: 140px;
        padding-bottom: 20px;    
    }

    .txt-result{
        display: inline-block;
        width: 60px;        
        font-size: 16px;
    }

   
    #cpf,#contrato{
        margin-left: 70px;
    }

    #contrato{
        display: inline-block;
        width: 90px;
    }
   
    #container{
        width: 1000px;
        margin: auto;
        padding-top: 30px;
    }

    #titulo{
        position: relative;
        top: 15px;
        text-align: center;
        font-size: 21px;
        font-style: italic;
        margin-bottom: 40px;
    }

    a img { border: 0px;}

    #operacoes{       
        position: relative;                
        top: -45px;
        left: 80px;
    }

    .impar{
        background-color: #CECFD0;
    }   

    
    .pagamento{
        width:65px;
        height:40px;
        float:left;
        text-align: center;
        margin-left: 7px;
        border-left: 1px  solid #999;
    }

    #mestra{
        margin-top: 20px;
    }

    #mestra .pagamento table tr td{
        text-align: center;
        padding-left: 7px;
    }
    

    .pagamento{
        width:79px;
        height:40px;
        float:left;
        text-align: center;
        margin-left: 7px;
        border-left: 1px  solid #999;        
        margin-bottom: 30px;
    }

     .pagamento table tr td{
        text-align: center;
        padding-left: 2px;
    }

    #totalContrato{
        clear: both;        
        margin-top: 100px;
        margin-bottom: 100px;
        font-size: 22px;
        text-align: center
}
</style>


<div id="logo_cons_result_user">
    <img src="http://www.meredyk.com.br/imagens/cabecir.png">
</div>

<div id="titulo">DEMONSTRATIVO DE PAGAMENTOS EFETUADOS EM <?=$this->ano;?></div>


<?
   if($this->total > 0){
?>

        <div id="operacoes">
            <a href="<?=$this->url(array('controller' => 'ir', 'action' => 'usuario', 'CPF' => $this->cpf,'pdf' => 'true'))?>" title="Gerar PDF"><img src="http://www.meredyk.com.br/imagens/pdf.png"></a>
            <a href="JavaScript:window.print();" title="Imprimir"><img src="http://www.meredyk.com.br/imagens/print.png"></a>
        </div>

        <div style="border-top: 1px solid #000; padding-top: 10px">
            <div><span class="txt-result">Nome: </span><? echo $this->titudep->nome?></div>
            <div>
                 <span class="txt-result">Tipo:</span><b><? echo ($this->titudep->tipo == 'T') ? 'Titular' : 'Dependente';?></b>
                 <span id="cpf" class="txt-result">CPF: </span><? echo $this->titudep->cpf?>
                 <span id="contrato">Contrato:</span> <? echo $this->titudep->contrato?>                 
            </div>
        </div>


                        <div id="mestra">
                        <?
                           $pagamento = $this->titudep->findDependentRowSet('Application_Model_DbTable_Pagamento');

                           $total = 0;
                           $totalContrato = 0;
                           foreach ($pagamento as $pagamentoItens) {
                        ?>
                            <div class="pagamento">
                                <table style="float: left">
                                  <tr>
                                    <td>
                                        <?
                                           $data = explode('-',$pagamentoItens->mes_referencia);
                                           echo $data[1].'/'.$data[0];
                                        ?>
                                    </td>
                                   </tr>
                                   <tr>
                                     <td>
                                       <?=number_format($pagamentoItens->valor , 2, ',', '.');?>
                                     </td>
                                   </tr>
                              </table>
                            </div>
                        <?
                            $total += $pagamentoItens->valor;                            
                          }
                          $totalContrato += $total;
                        ?>
                        <div class="pagamento">
                            <table>
                                <tr><td><b>Total</b></td></tr>
                                <tr><td><?=number_format($total , 2, ',', '.');?></td></tr>
                            </table>
                         </div>
                     </div>


                        <?
                            $titudep = new Application_Model_DbTable_TituDep();
                            $select = $titudep->select()->where('contrato = ' . $this->titudep->contrato . ' and id <> ' . $this->titudep->id);
                            $titudepRow = $titudep->fetchAll($select);

                            foreach ($titudepRow as $tituDepItens)
                            {
                       ?>
                                <div style="clear: both;border-top: 1px solid #000; padding-top: 10px ">
                                    <div><span class="txt-result">Nome: </span><? echo $tituDepItens->nome?></div>
                                    <div>
                                         <span class="txt-result">Tipo:</span><b><? echo ($tituDepItens->tipo == 'T') ? 'Titular' : 'Dependente';?></b>
                                         <span id="cpf" class="txt-result">CPF: </span><? echo $tituDepItens->cpf?>
                                    </div>
                                </div>


                        <div id="mestra">
                        <?
                           $pagamento = $tituDepItens->findDependentRowSet('Application_Model_DbTable_Pagamento');

                           $total = 0;
                           foreach ($pagamento as $pagamentoItens) {
                        ?>
                            <div class="pagamento">
                                <table style="float: left">
                                  <tr>
                                    <td>
                                        <?
                                           $data = explode('-',$pagamentoItens->mes_referencia);
                                           echo $data[1].'/'.$data[0];
                                        ?>
                                    </td>
                                   </tr>
                                   <tr>
                                     <td>
                                       <?=number_format($pagamentoItens->valor , 2, ',', '.');?>
                                     </td>
                                   </tr>
                              </table>
                            </div>
                        <?
                            $total += $pagamentoItens->valor;
                            //$totalContrato += $total;
                          }
                          $totalContrato += $total;
                        ?>
                        <div class="pagamento">
                            <table>
                                <tr><td><b>Total</b></td></tr>
                                <tr><td><?=number_format($total , 2, ',', '.');?></td></tr>
                            </table>
                         </div>
                     </div>


                       <?
                            }                           
                       ?>

                     <div id="totalContrato">
                          Total Contrato: <?=number_format( $totalContrato , 2, ',', '.');?>
                     </div>

<?
   }
   else{
?>
<center>
        Nenhum registro localizado!<br ><br >
        <a href="http://www.benservi.com.br/contato/">Entre em Contato</a>
</center>
<?
   }
?>
                